<template>
  <div>
    <h1>Gege</h1>
    <h1>{{count}}</h1>
    <button @click="add">累加</button>
    <button @click="beybey">取消订阅</button>
  </div>
</template>

<script>
import PubSub from 'pubsub-js'
export default {
    name:'Gege',
    data(){
        return {
            count:0
        }
    },
    methods:{
        add(){
            this.count++
            PubSub.publish('count',this.count)
        },
        beybey(){
            PubSub.unsubscribe('count')
        }
    }
}
</script>

<style>

</style>